<template>
  <div class="member-home">
      <!-- 概览 -->
      <HomeView />
      <!-- 收藏 -->
      <MemberHomePanel title="我的收藏" >
        <GoodsItem  v-for="item in collectGoods" :key="item.id" :sub="item" />
      </MemberHomePanel>
      <!-- 足迹 -->
      <MemberHomePanel title="我的足迹">
        <GoodsItem v-for="item in findBrowseHistorys" :key="item.id" :sub="item" />
      </MemberHomePanel>
      <!-- 猜你喜欢 -->
        <GoodsRelevant />
  </div>
</template>
<script>
import HomeView from './components/home-overview'
import MemberHomePanel from './components/home-pannel'
import GoodsRelevant from '@/views/goods/components/goods-relevant'
import GoodsItem from '@/views/category/components/goods-item'
import { findCollect, findBrowseHistory } from '@/api/member'
import { ref } from 'vue'
export default {
  name: 'MemberHome',
  components: {
    HomeView,
    MemberHomePanel,
    GoodsRelevant,
    GoodsItem
  },
  setup () {
    // 调用模拟接口
    const collectGoods = ref([])
    findCollect({
      page: 1,
      pagesize: 4
    }).then(data => {
      collectGoods.value = data.result.items
    })

    const findBrowseHistorys = ref([])
    findBrowseHistory({
      page: 1,
      pagesize: 4
    }).then(data => { findBrowseHistorys.value = data.result.items })
    return { collectGoods, findBrowseHistorys }
  }
}
</script>

<style scoped lang="less">
:deep(.xtx-carousel .carousel-btn.prev) {
    left:5px;
}
:deep(.xtx-carousel .carousel-btn.next) {
    right:5px;
}
</style>
